// Header Protection
#ifndef _RENDERSYSTEM_H_
#define _RENDERSYSTEM_H_

// Include Files
#include "Definitions.h"
#include "System.h"

// Forward Declarationsz
class CRenderNode;

//// game
//class CGame;

//// managers
//class CMeshManager;
//class CShaderManager;
//class CTextureManager;

//// TODO: ???
//class CWindow;
//class CCamera;

//// event arguments
//class CMeshEventArg;
//class CShaderLoadEventArg;
//class CTextureEventArg;
//class CRenderStateEventArg;

// Namespace
namespace IE
{
	/////////////////////////////////////////////////////////////////////////////////
	// A system which renders the scene.
	class CRenderSystem : public ABCSystem
	{
	public:     // methods
		CRenderSystem() : ABCSystem() { }
		virtual ~CRenderSystem() { }

		// Initialize the render system.
		void Initialize();

		// Shutdown the render system.
		void Shutdown();

		//private:    // event handlers
		//
		//	void OnMeshLoad( CMeshEventArg &_rArg );
		//	void OnMeshUpdate( CMeshEventArg &_rArg );
		//	void OnShaderLoad( CShaderLoadEventArg &_rArg );
		//	void OnTextureLoad( CTextureEventArg &_rArg );
		//
		//	// Called when a render state is added
		//	void OnRenderStateAdd( CRenderStateEventArg &_rArg );
		//
		//	// Called when a render state is removed
		//	void OnRenderStateRemove( CRenderStateEventArg &_rArg );
		//
		//	// Called when a render state is updated
		//	void OnRenderStateUpdate( CRenderStateEventArg &_rArg );

	private:    //  ABCSystem override methods

		// Called when the thread is started.
		virtual void ThreadBegin();

		// Called when the thread is stopped.
		virtual void ThreadEnd();

		// Called at the frame rate with which StartThread was called.
		// _fTime: float_t - the seconds that have passed since the last tick
		virtual void ThreadTick( float_t _fTime );

		//// Handles windows messages for the window
		//static LRESULT CALLBACK WndProc( 
		//	HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );

	private:    // data
		flist_t<CRenderNode *> m_lstNodes;

	private:    // dummy definitions
		CRenderSystem( CRenderSystem const & );
		CRenderSystem &operator =( CRenderSystem const & );

		//private:    // data
		//
		//// assets
		//CSingleton<CMeshManager>    m_pMeshManager;
		//CSingleton<CShaderManager>  m_pShaderManager;
		//CSingleton<CTextureManager> m_pTextureManager;

		//// systems
		//CSingleton<CGame>   m_pGame;

		//// OpenGL handles
		//HWND  m_hWnd;
		//HDC   m_hGLDevice;
		//HGLRC m_hGLRender;

		//// TODO: not sure where to put this, probably in CScene...
		//CCamera *m_pCamera;

		//// states to be rendered
		//flist_t<CRenderState *> m_lstRenderStates;

		//// TODO: remove/replace this
		//void ReSizeGLScene(uint_t width, uint_t height);
	};
}

// Header Protection
#endif // _RENDERSYSTEM_H_
